<?php
$server='localhost';
$unam="root";
$umm="root";
$db="maxik";
$con=mysqli_connect($server,$unam,$umm,$db);

if($con){
    $name=$_POST['name'];
    $age=$_POST['age'];
    $ads=$_POST['ads'];
    $jinis=$_POST['jinis'];

    $img_self=$_FILES["img"]["tmp_name"];
    $img_name="uu/".$_FILES["img"]["name"];
    $ok = move_uploaded_file($img_self,$img_name);
    
    if($ok){
        $go="insert into upload (name,age,ads,img,sex)values('$name','$age','$ads','$img_name','$jinis')";
        $go_ok=mysqli_query($con,$go);
        if ($go_ok){
            echo "添加成功！";
        }else{
            echo "数据库链接和文件上传成功，但是数据添加失败！";
        }
    }else{
        echo "数据库链接成功，但是数据上传失败！";
    }
}else{
    echo "数据库链接失败:".mysqli_connect_error();
}